#ifndef XGE_XPRIORITY_TASK_H_
#define XGE_XPRIORITY_TASK_H_
#include "xge_common_config.h"
#include "xtask.h"
#include "xstring.h"

namespace xge{
  using xge_internal::Task;
  // Priority task 
  // this task can set priority but it can not be deleted
  // Why ? because to maintain a order queue for good performance
  // and also provide delete routine is impossible !
  // STL priority queue can not offer delete operation
  // since even if we get the container and delete , but the heap order has been runined 
  // this pretty slow
  class PriorityTask : public Task {
  public:
    typedef size_t priority_t;
    // XPriorityTask ctor
    PriorityTask( priority_t priority , int task_type ,  const String& name ) : 
    priority_(priority) , name_(name) , Task( Task::DOWNCAST_PRIORITY_TASK , task_type) {}

  public:
    // name of this specific task
    const String& name() const {
      return name_;
    }
    // priority of this task
    priority_t priority() const {
      return priority_;
    }
    // get the min priority allowed 
    static priority_t GetMinPriority() {
      return size_t();
    }
  private:
    // name of this task
    String name_;
    // priority of this class
    priority_t  priority_;

  };

}// namespace xge

#endif// XGE_XPRIORITY_TASK_H_